<template>
  <div>
    <com-vue></com-vue>
    <button v-for="(tab,k) in tabs" :key="k" :class="{active:currentTab===tab}" @click="currentTab = tab">{{tab}}</button>

    <transition name="component-fade" mode="out-in">
      <component :is="currentTabComponent"></component>
    </transition>
  </div>
</template>

<script>
  export default {
    name: "watch",
    data() {
      return{
        currentTab:'Home',
        tabs:['Home','Pos'],

      }
    },
    computed:{
      currentTabComponent(){
        return 'tab'+this.currentTab;
      }
    }

  }
</script>

<style scoped>
.active{
  color: red;
}
.component-fade-enter-active, .component-fade-leave-active {
  transition: opacity .3s ease;
}
.component-fade-enter, .component-fade-leave-to
  /* .component-fade-leave-active for below version 2.1.8 */ {
  opacity: 0;
}
</style>
